<?php
require('connect.sql.php');
require('admin.function.php');
require('sql.function.php');

echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";


$groupid=$_POST['groupid'];
$fid=$_POST['fid'];

$_POST['groupid']=0;
$_POST['fid']=0;

if($fid)
{
	$res=0;
	//添加测评人员
	if($fid==1){
		foreach ($_POST as $key => $value) {
			if($value){
				$query="'".$key."','".$groupid."'";
				$res=insertdata("app_user_sup","userid,groupid",$query);
				if($res){
					echo $key."：添加成功<br/>";
				}
				else
				{
					echo $key."：添加失败，该用户已添加<br/>";
				}
				
			}
		}
	}
	//添加普通成员
	else if($fid==2){
		foreach ($_POST as $key => $value) {
			if($value){
				$query="'".$key."','".$groupid."'";
				$res=insertdata("app_user","userid,groupid",$query);
				if($res){
					echo $key."：添加成功<br/>";
				}
				else
				{
					echo $key."：添加失败，该用户已添加<br/>";
				}
				
			}
		}
	}
	//添加项目
	else if($fid==3){
		foreach ($_POST as $key => $value) {
			if($value){
				$query="'".$key."','".$groupid."'";
				$res=insertdata("app_sort_group","sortid,groupid",$query);
				if($res){
					echo $key."：添加成功<br/>";
				}
				else
				{
					echo $key."：添加失败，该项目已添加<br/>";
				}
				
			}
		}
	}
}
?>